package com.rgp.servicepay.controller;

import com.rgp.internalcommon.dto.ResponseResult;
import com.rgp.servicepay.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author nhp
 * @version 1.0
 * @description TODO
 * @date 2024-04-26 21:50
 */
@Controller
public class PayController {

    @Autowired
    private PayService payService;

    @PostMapping("/pay/face-to-face")
    @ResponseBody
    public ResponseResult faceToFacePay(@RequestParam("orderId") String orderId,
                                        @RequestParam("price") String price,
                                        @RequestParam("passengerId") String passengerId){
        return payService.faceToFacePay(orderId,price,passengerId);
    }

    @PostMapping("/pay/check-trade-action")
    public ResponseResult checkTradeAction(HttpServletRequest request, HttpServletResponse response){
        return payService.checkTradeAction(request,response);
    }

    @PostMapping("/pay/notify-callback")
    public void notifyCallback(HttpServletRequest request,HttpServletResponse response){
        payService.notifyCallback(request,response);
    }
}
